home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / bbs / igmkit10.zip / SRC_CODE.ZIP / SKELETON.PAS < prev    next >
Pascal/Delphi Source File  |  1997-06-20  |  8KB  |  337 lines

  1. {
  2.     This file is intended to be used to create IGM's for Hackers: the Role
  3.     Playing Game using the Door Driver called DDPlus, and Turbo Pascal 7.0.
  4.     Talon Software does not insure that this source code will work, and
  5.     we do not insure that it will correctly work on any other door driver.
  6.     You may modify this source as you please..  But give credits to Talon
  7.     Software in your documentation.. Thank you.
  8.  
  9.     All we ask from using this Skeleton, is to inform us about your IGMs
  10.     creation, and we will add it to our IGM list for future IGMKits..
  11.  
  12.  
  13.     One little note..  When ever it says something about GAME it means
  14.     Hackers: the Role Playing Game, not the IGM you are making..
  15.  
  16.  
  17.                                             Talon Software
  18. }
  19. program TalonSoftware_IGM_Skeleton;
  20.  
  21. uses DDPlus, CRT;
  22.  
  23.  
  24. type
  25.  
  26. IGMData=Record              {This is the data that is to be put on the IGM's}
  27.     UserFN: string[30];        { player file.  You may add more to it, but these}
  28.        UserLN: string[30];        { two lines are required if you are going to use }
  29. end;                        { this skeleton.}
  30.  
  31. PwrdStr=string[13];
  32.  
  33. ifno = record                         {This is the Game's Player info..}
  34.      UserFN: string[30];             {DO NOT MODIFY THE ORDER OF THE}
  35.      UserLN: string[30];              {VARIABLES OR THE IGM *WILL* CORRUPT}
  36.      Handle: array[1..20] of char;    {THE PLAYER.DAT FILE FOR THE GAME!!}
  37.      Gang: integer;                    {You may change the names of the variables}
  38.      Feds: integer;                    {though. }
  39.  
  40.      Level: integer;
  41.      Exper: integer;
  42.      Money: single;
  43.      Actions: integer;
  44.  
  45.      CPU: integer;
  46.      RAM: integer;
  47.      OS: integer;
  48.      MaxHD: single;
  49.      HD: single;
  50.      Modem: longint;
  51.      Mother: integer;
  52.      Security: integer;
  53.      Groups: integer;
  54.  
  55.      Cracker: integer;
  56.      WarDialer: Boolean;
  57.      RedBox: Boolean;
  58.      BeigeBox: Boolean;
  59.      AquaBox: Boolean;
  60.  
  61.      Password1:PwrdStr;
  62.      PwLeng1: integer;
  63.      Password2: PwrdStr;
  64.      PwLeng2: integer;
  65.      Password3: PwrdStr;
  66.      PwLeng3: integer;
  67.  
  68.      ISP: single;
  69.      Phone: single;
  70.      Jailed: Boolean;
  71.      JailDays: integer;
  72.      NoPayDays: Integer;
  73.      SellInfo: longint;
  74.      Servers: array[1..45] of integer;
  75.      Plans: array [1..3] of boolean;
  76.      Parts: array[1..12] of Boolean;
  77.      Files: array [1..1000] of single;
  78.      Talked: Boolean;
  79.      CPUSpeed: integer;
  80.      Already: array[1..10] of integer;
  81.       GroupN: string[20];
  82.  
  83.      {Internal Variables}
  84.      Deleted: Boolean;
  85.      PlayedToday: Boolean;
  86.      HandLen: integer;
  87.      Online: Boolean;
  88.      DaysPlayed: integer;
  89. end;
  90.  
  91. GFile= File of Ifno;
  92. IFile= File of IGMData;
  93.  
  94.  
  95. var IGMDirectory, GameDirectory: string;
  96.     Game: ifno;
  97.     IGM: IGMData;
  98.     IGMF: Ifile;
  99.     GameF: GFile;
  100.     IGMNum, GameNum: integer;
  101.  
  102. const GameData='PLAYER.DAT'; {This is the name of the Hacker's player info
  103.                                 file, do not modify}
  104.       PlayData='IGM.DAT';   {This is the name of the IGM's player info, this
  105.                                you can modify}
  106.  
  107.  
  108.  
  109. function Exist(FileName: String): Boolean; {This function will return TRUE
  110.                                             or FALSE depending on if the
  111.                                             specified file exists}
  112. var
  113.   F: file;
  114. begin
  115.   {$I-}
  116.   Assign(F, FileName);
  117.   Reset(F);
  118.   Close(F);
  119.   {$I+}
  120.   Exist := (IOResult = 0) and (FileName <> '');
  121. end;
  122.  
  123.  
  124. procedure Nl (times:integer); {Sends TIMES line feeds}
  125. var Tm:integer;
  126. begin
  127.      for Tm:=1 to Times do
  128.          swriteln('');
  129. end;
  130.  
  131.  
  132. function Center(Cntr: string): string; {An unorgranized function that returns
  133.                                         a centered string from the string that
  134.                                         it recieves}
  135.  
  136. var LongInte,TM: integer;
  137.     Longreal: real;
  138. begin
  139.      LongInte:=length(Cntr);
  140.      if LongInte Mod 2 <> 0 then
  141.           LongInte:=LongInte+1;
  142.  
  143.      LongReal:=80-LongInte;
  144.      LongReal:=LongReal/2;
  145.      for Tm:=1 to 80 do
  146.          begin
  147.               Cntr:=' ' + Cntr;
  148.               if Tm>=LongReal+1 then
  149.                  begin
  150.                  Tm:=80;
  151.               end;
  152.          end;
  153.      Center:=Cntr;
  154. end;
  155.  
  156.  
  157.  
  158. procedure Pause;  {Generic Pause Command}
  159. var PauseChar: char;
  160. begin
  161.     Set_Color(14,0);
  162.     SWriteln(CENTER('PRESS ANY KEY TO CONTINUE'));
  163.     SRead_Char(PauseChar);
  164. end;
  165.  
  166. procedure FileGame;  {File Locking Procedure for the GAME Player DATA}
  167. var GoAhead: Boolean;
  168.     OpenAttempts:Byte;
  169. begin
  170.     assign(GameF,GameDirectory+GameData);
  171.     OpenAttempts:=1;
  172.     Repeat
  173.       {$I-}
  174.        Reset(GameF); {opens the file}
  175.        {$I+};
  176.        GoAhead:= (IOResult = 0);
  177.        If Not GoAhead then OpenAttempts :=OpenAttempts+1;
  178.     Until (GoAhead) or (OpenAttempts>1000);
  179.  
  180. end;
  181.  
  182. procedure FileIGM; {File Locking Procedure for the IGM Player DATA}
  183. var GoAhead: Boolean;
  184.     OpenAttempts:Byte;
  185. begin
  186.     assign(IGMF,IGMDirectory+PlayData);
  187.     OpenAttempts:=1;
  188.     Repeat
  189.       {$I-}
  190.        Reset(IGMF); {opens the file}
  191.        {$I+};
  192.        GoAhead:= (IOResult = 0);
  193.        If Not GoAhead then OpenAttempts :=OpenAttempts+1;
  194.     Until (GoAhead) or (OpenAttempts>1000);
  195.  
  196. end;
  197.  
  198.  
  199.  
  200. function LoadConfig: Boolean;
  201. var FileVar: text;
  202.     Good: Boolean;
  203. begin
  204.     {This function will read the info off of the Config file..  If the file
  205.         exists it will return TRUE, if it doesn't exist it will return FALSE}
  206.  
  207.     assign(FileVar, 'CONFIG.CFG'); {Replase CONFIG.CFG with your Config File
  208.                                     Files name}
  209.     Good:=True;
  210.     if Exist('CONFIG.CFG') then  {Will check to see if CONFIG.CFG is in the
  211.                                     current directory}
  212.         reset(FileVar)
  213.     else
  214.         begin
  215.             SClrSCr;
  216.             Set_Color(12,0);
  217.             NL(4);
  218.             SWRiteln(CENTER('YOUR SYSOP DOES NOT HAVE THIS IGM'));
  219.             SWRiteln(CENTER('SETUP CORRECTLY, PLEASE ASK YOUR'));
  220.             SWRiteln(CENTER('SYSOP TO FIX IT.'));
  221.             Good:=False;
  222.             Nl(4);
  223.             Pause;
  224.             exit;
  225.         end;
  226.  
  227.     Readln(FileVar, GameDirectory); {These two lines should be the first two}
  228.     Readln(FileVar, IGMDirectory); {Lines of all IGM Config files.. They simply
  229.                                     tell the location of the IGM and the Game
  230.                                     for use by the IGM..   This skeleton of an
  231.                                     IGM will NOT work without them.}
  232.     SclrScr;
  233.     Close(FileVar);
  234.     LoadConfig:=Good;
  235. end;
  236.  
  237. procedure LoadIGM;
  238. var Num: integer;
  239. begin
  240.  
  241.     {THIS Procedure will load the Game Player data, and IGM Player Data
  242.         for the IGM to use and modify, but it will not put it back onto
  243.         the file when the IGM is finished, that is your job.}
  244.  
  245.     assign(IGMF, IGMDirectory+'IGM.DAT');
  246.     if Not Exist(IGMDirectory+'IGM.DAT') then
  247.         begin
  248.             rewrite(IGMF);
  249.             close(IGMF);
  250.         end;
  251.  
  252.     FileGame;
  253.     FileIGM;
  254.  
  255.     Num:=0;
  256.     GameNum:=0;
  257.     repeat
  258.        Num:=Num+1;
  259.        if Eof(GameF) then break;
  260.        Read(GameF, Game);
  261.        if Game.UserFN=USER_FIRST_NAME then
  262.           if Game.UserLN=USER_LAST_NAME then
  263.                  begin
  264.                    GameNum:=Num;
  265.                  break;
  266.                end;
  267.  
  268.     until EOF(GameF);
  269.  
  270.     if GameNum=0 then GameNum:=FileSize(GameF);
  271.  
  272.     Close(GameF);
  273.  
  274.     Num:=0;
  275.     IGMNum:=0;
  276.     repeat
  277.         if Eof(IGMF) then break;
  278.         Read(IGMF, IGM);
  279.         Num:=Num+1;
  280.  
  281.         if (IGM.UserFN=USER_FIRST_NAME) and (IGM.UserLN=USER_LAST_NAME) then
  282.             begin
  283.                 IGMNum:=Num;
  284.                 break;
  285.             end;
  286.      until EOF(IGMF);
  287.  
  288.     if IGMNum=0 then
  289.         begin
  290.             IGMnum:=FileSize(IGMF);
  291.             Seek(IGMF, IGMNum);
  292.             IGM.UserFN:=USER_First_Name;
  293.             IGM.UserLN:=User_Last_Name;
  294.             Write(IGMF, IGM);
  295.         end;
  296.     close(IGMF);
  297.  
  298.  
  299. end;
  300.  
  301.  
  302.  
  303.  
  304. procedure StartIGM;
  305. begin
  306.  
  307.     {BEGINING OF IGM}
  308.  
  309. end;
  310.  
  311.  
  312. procedure RunMaint;
  313. begin
  314.  
  315.     {PUT YOUR MAINTENANCE CODE HERE}
  316.  
  317. end;
  318.  
  319.  
  320. begin {MAIN}
  321.  
  322. initdoordriver('DOOR.CTL');  {Default CTL file required to run the game}
  323. ProgName:='IGM NAME';  {Put your IGM Name here for the status bar}
  324. Randomize;
  325. AnsiOn:=True;  {Forces caller into ANSI}
  326. if LoadConfig=True then  {If the configuration loaded successfully then go on}
  327.     begin
  328.         LoadIGM; {Gets GAME Player #, and IGM Player #}
  329.         RunMaint; {Runs Maintenance if required}
  330.         StartIGM; {Goes to first part of IGM, for displaying rules etc..}
  331.     end
  332. else
  333.     exit;
  334.  
  335. end.
  336.  
  337. {Thats it.. We hope this helps you create the IGM of your dreams}